/**
 * 
 */
package br.com.lazyprogrammer.social.infestit.network.builder;

/**
 * 
 * @author Limao Games <br />
 * <b>Email:</b> andreikeda@limaogames.com.br <br />
 * created on: 07/05/2014
 * @version 1.0
 * @see 
 */
public class URLBuilder {
	
	public enum Type {
		ME,
		Friend;
		
		public static String getType(Type type) {
			switch(type) {
				case ME:
					return "me";
				case Friend:
					return "friend";
			}
			
			return "";
		}
	}
	
	private final String URL_HOST	= "http://www.limaogames.com.br/applications/infestit/%s/methods.php";
    private final String URL_NEAR_PLACES = "https://maps.googleapis.com/maps/api/place/search/json?location=%s,%s&radius=%d&sensor=false&key=%s";
    private final String URL_PLACE_DETAIL = "https://maps.googleapis.com/maps/api/place/details/json?reference=%s&sensor=false&key=%s";

	public URLBuilder() {
		
	}

    public String buildUrlNearPlaces(double latitude, double longitude, int radius, String placesKey) {
        StringBuilder url = new StringBuilder(String.format(URL_NEAR_PLACES, String.valueOf(latitude), String.valueOf(longitude), radius, placesKey));
        return url.toString();
    }

    public String buildUrlPlacesDetail(String reference, String placesKey) {
        StringBuilder url = new StringBuilder(String.format(URL_PLACE_DETAIL, reference, placesKey));
        return url.toString();
    }

	public String buildUrlSystem(Type type) {
		StringBuilder url	= new StringBuilder(String.format(URL_HOST, Type.getType(type)));
		return url.toString();
	}

}
